//5.观察者模式之events
let eventEmitter = require('events');
let util = require('util');
let eve = new eventEmitter();
// eve.on('click',(res)=>{
//     console.log(res);
// });
// eve.emit('click','9999');

//继承
function Bell() {  };
//第一种写法
util.inherits(Bell,eventEmitter);
//第二种写法
Bell.prototype = Object.create(eventEmitter.prototype);
//第三种写法
function temp() {  };
temp.prototype = eventEmitter.prototype;
Bell.prototype = new temp();
//第四种写法
let bell = new Bell();
bell.__proto__ = eventEmitter.prototype;

bell.on('hello',function (param) {
    console.log('okkkkkk')
  });

bell.emit('hello');